package com.kh.statistics.video.core.algorithm;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: statistics
 * @BelongsPackage: com.kh.statistics.video.core.algorithm
 * @Author: Hong.Kong
 * @CreateTime: 2024-05-13  11:11
 * @Description: TODO
 * @Version: 1.0
 */
public class KuaiShouAlgorithm {

    /**
     * 把url中的参数放入map1中；
     * 把表单中的参数放入map2中；
     *
     * @param map
     * @param map2
     * @return
     */
    public static List<String> algorithm(Map<String, String> map, Map<String, String> map2) {
        List<String> arrayList = new ArrayList(map.size() + map2.size());
        for (Map.Entry entry : map.entrySet()) {
            arrayList.add(((String) entry.getKey()) + "=" + (entry.getValue() == null ? "" : (String) entry.getValue()));
        }
        for (Map.Entry entry : map2.entrySet()) {

            arrayList.add(((String) entry.getKey()) + "=" + (entry.getValue() == null ? "" : (String) entry.getValue()));
        }
        try {
            Collections.sort(arrayList);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
        return arrayList;
    }

}
